<div>
    <fieldset>
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>
                        <input type="checkbox"  id="selectAll"> 
                    </th>
                    <th><?php echo '账号'; ?></th>
                    <th><?php echo '手机'; ?></th>
                    <th><?php echo '姓名'; ?></th>
                    <th><?php echo '性别'; ?></th>
                    <th><?php echo '积分'; ?></th>
                    <th><?php echo '操作'; ?></th>
                </tr> 
            </thead>
            <tbody>
                <?php
                $userCooker = new BAUserCooker();
                foreach ($memberPointAccountList as $id => $list) {
                    if ($list->getItem('userInfoId') != NULL) {
                        $userInfoId = $list->getItem('userInfoId')->getValue();
                        $oUserInfo = $userCooker->getUserInfoById($userInfoId);
                        $account['userInfoId'] = $list->getItem('userInfoId')->getValue();
                        if ($oUserInfo->getItem('mobile') != NULL) {
                            $account['mobile'] = $oUserInfo->getItem('mobile')->getValue();
                        }
                        if ($oUserInfo->getItem('email') != NULL)
                            $account['email'] = $oUserInfo->getItem('email')->getValue();
                        $name = '';
                        if ($oUserInfo->getItem('familyName') != NULL) {
                            $name = $oUserInfo->getItem('familyName')->getValue();
                        }
                        if ($oUserInfo->getItem('surName') != NULL) {
                            $name .= $oUserInfo->getItem('surName')->getValue();
                        }
                        $account['userName'] = $name;
                        if ($oUserInfo->getItem('gender') != NULL)
                            $account['gender'] = $oUserInfo->getItem('gender')->getValue();
                    }
                    if ($list->getItem('accountId') != NULL)
                        $account['accountId'] = $list->getItem('accountId')->getValue();
                    if ($list->getItem('lastChangeTime') != NULL)
                        $account['lastChangeTime'] = $list->getItem('lastChangeTime')->getValue();
                    if ($list->getItem('memberPoint') != NULL)
                        $account['memberPoint'] = $list->getItem('memberPoint')->getValue();
                    if ($list->getItem('memberPointTypeId') != NULL)
                        $account['memberPointTypeId'] = $list->getItem('memberPointTypeId')->getValue();

                    $accountId = $account['accountId'];
                    $userName = '';
                    if (isset($account['userName']))
                        $userName = $account['userName'];
                    $gender = '--';
                    if (isset($account['gender']))
                        $gender = $account['gender'];
                    $userInfo = '';
                    $mobile = '--';
                    if (isset($account['mobile'])) {
                        $mobile = $account['mobile'];
                        $userInfo .=';' . $account['mobile'];
                    }
                    if (isset($account['memberPoint']))
                        $point = $account['memberPoint'];
                    else
                        $point = 0;
                    $changeTime = $account['lastChangeTime'];
                    $changeTime = date('y/m/d h:i:sa', ($changeTime));
                    $memberPointTypeId = $account['memberPointTypeId'];
                    ?>
                    <tr>
                        <td><label class="checkbox">
                                <input type="checkbox" name="checkbox[]" value="<?php echo $id; ?>"> 
                            </label></td>
                        <td> <?php echo $accountId; ?> </td>
                        <td> <?php echo $mobile; ?> </td>     
                        <td> <?php echo $userName; ?> </td>   
                        <td> <?php echo $gender; ?> </td>     
                        <td> <?php echo $point; ?> </td>     
                        <td>
                            <div class="row-fluid">                                                         
                                <?php
                                echo $control->getAjaxLink(array('name' => '修改', 'id' => 'showMemberPointAccountDetail'), array(
                                    'cooker' => 'BAMemberPoint@showAddMemberPointAccount',
                                    'memberPointAccountId' => $id
                                ));
                                ?> | 
                                <?php
                                echo $control->getAjaxLink(array('name' => '增减', 'id' => 'showAddDeductMemberPoint'), array(
                                    'cooker' => 'BAMemberPoint@showAddDeductMemberPoint', 'accountIdNumber' => $accountId,
                                    'memberPointAccountId' => $id, 'currentPoint' => $point
                                ));
                                ?> |
                                <?php
                                echo $control->getAjaxLink(array('name' => '记录', 'id' => 'showMemberPointHistory'), array(
                                    'cooker' => 'BAMemberPoint@showMemberPointHistoryByType', 'accountIdNumber' => $accountId,
                                    'memberPointAccountId' => $id, 'memberPointTypeId' => $memberPointTypeId
                                ));
                                ?> 
                            </div>                      
                        </td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>

        <div><input type="hidden" name="curPageNo" value="1"></div>

        <div class="pagination">  
            <ul>  
                <li class="active">
                    <a href="javascript:void()">前一页</a>    </li>  
                <li class="active">
                    <a href="javascript:void()">1</a>    </li>  
                <li class="active">
                    <a href="javascript:void()">后一页</a>    </li>  
            </ul>  
        </div>
        <div>
            <?php
            echo $control->getAjaxLink(array(
                'name' => '添加新账号', 'id' => 'showAddMemberPointAccount'
                    ), array(
                'cooker' => 'BAMemberPointCooker@showAddMemberPointAccount',
                'htmlOptions' => array('class' => 'btn')
            ));
            ?>
            <?php
            echo $control->getAjaxLink(array(
                'name' => '操作记录', 'id' => 'showMemberPointHistory'
                    ), array(
                'cooker' => 'BAMemberPointCooker@showMemberPointHistory',
                'htmlOptions' => array('class' => 'btn')
            ));
            ?>
        </div>
</div>